import contextlib


@contextlib.contextmanager
def file_open(file_name):
    print('file open')
    yield {
        print('pass')

    }
    print('file close')
    return 'file is me'


with file_open('ok') as f:
    print(f)

